/**
 * 组织Meta
 */
K.defMeta("com.joypard.platform.organization.org.OrgDI", {
	statics : {
		urls : {
			getOrgChildrens : $path + "/organization/org/getOrgChildrens.do",
			getRoot : $path + "/organization/org/getOrgRoot.do",
			addOrg : $path + "/organization/org/addOrg.do",
			updateOrg : $path + "/organization/org/updateOrg.do",
			delOrg : $path + "/organization/org/delOrg.do",
			addOrgUser : $path + "/organization/org/OrgUser/addUser.do",
			getOrgUsers : $path + "/organization/org/OrgUser/getOrgUsers.do",
			addOrgUsers : $path + "/organization/org/OrgUser/addOrgUsers.do",
			delOrgUsers : $path + "/organization/org/OrgUser/delOrgUsers.do"
		},

		/**
		 * 获取根组织
		 * 
		 * @param rootId
		 * @param loadChildren
		 *            是否加载子组织
		 * @returns
		 */
		getRootOrgInfo : function(rootId, loadChildren) {
			var rootNodeAttr = null;
			K.ajax({
				type : "GET",
				url : this.urls.getRoot,
				data : {
					orgId : rootId || "0",
					loadChildren : loadChildren || false
				},
				async : false,
				success : function(txt) {
					var output = K.createOutput(txt);
					rootNodeAttr = output.getParameter("org");
				},
				error : function() {
					K.err("加载根组织失败");
				}
			});

			return rootNodeAttr;
		}
	}
});